;*****************************************************************************
;    ______        __                  ______                     __  __   __
;   / __  /       / /                 / __  / ELBOX INSTALL      / /  \ \ / /
;  / /  -'__  __ / /___ ______ _____ / /_ -'_____ ______ ______ / /__  \ \ /
; / /     \ \/ // __  // ____// .__// // \ / .__// __  // __  // __  / /  /  V3
;/ /___    \  // /_/ // __/_ / /   / /_/ // /   / __  // /_/ // / / / / \ \
;\____/    / //_____//_____//_/   /_____//_/   /_/ /_// ____//_/ /_/ /_/ \_\
;         /_/                                        / /
;                                                   /_/
; S3           : Generic ViRGE 86C325 & ViRGE/DX 82C375 Driver
;
; CyberGraphX V3 1997-2000 Vision Factory Development
; CyberGraphX V3 Update Installer 1995,1996,1997,1998,1999,2000 by Robert C. Reiswig 
; Mediator 2000 by Elbox
; $VER: V0.48 (Oct-25-2000)
; 
; If you wish to use any part of this installer you must ask. May not be 
; integrated/placed into any other package! You may NOT change this in an way!
; You man NOT take or use the ENV definitions and use them without direct
; permission from me! Changes, suggestions or problems: rob@cgx.vgr.com
;********************************************************************************

;MediatorViRGE file name , rest ElboxViRGE

;********************************************************************************
; Cyber Release & Boards
;********************************************************************************
(set @user-level 2)
(set #cyberver "V3 41.2")
(set NoBoard 0)
(set whereback "SYS:Storage")
(message (cat "CyberGraphX " #cyberver "\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
              "Generic PCI\n\nViRGE (86C325) / ViRGE/DX (86C375)\n\ndrivers for the Elbox Mediator"
         )
)

(welcome)
;********************************************************************************
; Read All System information
;********************************************************************************
(set cpu (database "cpu")) (if (> (exists ("sys:libs/68060.library")) 0) (set cpu "68060") )
(set vblank (database "vblank")) (set graphmem (database "graphics-mem"))
(set totmem (database "total-mem")) (set osver (/ (getversion "LIBS:version.library") 65536))
(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))
( if (= osver 37) ( (set workbench "2.0")) ( if (= osver 38) ( (set workbench "2.1"))
( if (= osver 39) ( (set workbench "3.0")) ( if (= osver 40) ( (set workbench "3.1"))
( if (= osver 41) ( (set workbench "3.2")) )))))
(set pick 0)

;********************************************************************************
;English Strings
;********************************************************************************
(set #By (cat "\n\nCyberGraphX\n\nRelease Version " #cyberver "\n\n\n\n"
              "by:\n\nVision Factory Development"
          
         )
)

(set #askzorro "\nWhat type of machine is CyberGraphX V3 installed on?\n")
(set #askcpu "\nWhat CPU does the machine have that you are updating CyberGraphX V3 on? The installer has found:\n")
(set #wherelibs "Where do you want the CyberGraphX V3 libraries installed? The default is 'SYS:Libs'")
(set #whatboard (cat "\nPlease Select the Graphics Board(s) you wish to Install CyberGraphX V3 for:\n"))
(set #todo-prompt "\nDo you wish to install:\n")
(set #cgxmode-todo " CGXMode - Create & Change Screen Modes")
(set #wheremode "Where do you wish to copy the CGXMode Program?")
(set #whereshowcgxconfig "Where do you wish to copy the ShowCGXconfig Program?")
(set #showcgxconfig " ShowCGXconfig - CGX Info Program")

;***** New Strings for Aug-11-97
(set #nocvppcboard "\n\n\nCurrently there is no public driver for the CyberVisionPPC graphics card.")
(set #noretinaboard "\n\n\nCurrently there is no public driver for the Retina BLT Z3 graphics card.")
(set #nopicasso4board "\n\n\nCurrently there is no public driver for the Picasso IV graphics card.")
(set #noinfernoboard "\n\n\nCurrently there installer does not fully support the Inferno yet.")

(set #ask-MODEFILE1 "Which modefile should be installed for the ") 
(set #ask-MODEFILE2 "? The khz number should not exceed your monitors max khz!")
(set #15KHZ "15khz maximum") (set #31KHZ "31khz maximum")
(set #35KHZ "35khz maximum") (set #38KHZ "38khz maximum")
(set #48KHZ "48khz maximum") (set #57KHZ "57khz maximum")
(set #64KHZ "64khz maximum") (set #80KHZ "80khz maximum")

(set #yes "Yes")
(set #no "No")
(set #followingenv "\n\n\n\nThe following section will set the Env Vars for CyberGraphX V3.")
(set #whatboard-tt "\n\n\n\nThe following ToolTypes will be set for the:\n\n")


;*********** NEW English Strings:  Wednesday 03-Sep-97 *************************
(set #nobackup "\n\nThis installer will install CGX V3 for the first time. Before you start you should use the backup program that came with your RTG Graphics system. Then you should use the uninstaller that came with it. If it did not come with these, then you will need to remove it by hand.\n\nYou should do this now if you have not done so.")
(set #whatboot "\nWhat bootlogo would you like to use?\n")
(set #bootdefault "CyberGraphX - Default")
(set #bootppc "Light My Fire - PPC")
(set #bootnone "Don't copy - Already Installed")


;*********** NEW English Strings:  Wednesday 22-Oct-97 *************************

;*********** NEW English Strings:  Monday 01-Dec-97 *************************
(set #noaga "\n\n\nCurrently there installer does not fully support the AGA Chipset or the driver is not out. Please see http://www.vgr.com for more info.")
(set #CGXModeNot4AGA " CGXMode - Not for AGA Driver")
(set #noenvaga "\n\nThe following ENV VARs that you will set will be use by the _graphics card(s)_ that you selected. They will NOT be used by the AGA-PPC driver.")

;*********** NEW English Strings:  Wednesday 21-Jan-98 **********************
(set #updatep4flash "\nTo use CyberGraphX with the Picasso IV you should be running version 2.0 or greater of the Picasso IV FlashROM.\n\nThe installer has found a version lower then 2.0.\n\nForm more information and newer FlashROMs you can contact:\nYour Dealer\nVillage Tronic\nVillage Tronic Web site\n")

;*********** NEW English Strings:  Wednesday 11-Mar-98 **********************
(set #noppc1 "\n\nYou selected the PPC option for one of your CPUs. The installer did not find the 'libs:PPC.library'.\n\nCyberGraphX may not work correctly.\n\n Do you wish to reselect the CPU type?")
(set #noppcaga "\nYou selected the 'AGA (PPC Only)' option when picking what graphics card (display device) to use with CyberGraphX. The installer did not find the 'libs:PPC.library'.\n\n The AGACGX driver needs a PPC card installed to work correctly.\n\nDo you wish to Abort the install now?.")
(set #agaquit "\nCyberGraphX install/update exiting.")
 (set #noboard "\nOne of the board(s) or chipset(s) you selected is not currently supported.\n\nPlease look on http://www.vgr.com for an update or wait until the next CyberGraphX archive is released.\n\nThe card with the missing driver was the:\n") 


;*********** NEW English Strings: Monday 28-Aug-00 14:57:13 **********************
(set #envtt "\nCurrently CGX is set to the default settings.\n\n\nPlease see the CyberGraphX homepage\n\nhttp://www.vgr.com/cgx\n\nfor a full list of settings and what they do.")
(set #cgxv4 (cat "\nCheck out CyberGraphX V4 at:\nhttp://www.vgr.com/v4\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
                 "\n- Includes -\nCustom drivers for each PCI Elbox Card\nHardware blitter support\nCGXVideo support\nCGX Prefs Program\nLatest CGXMode\nCGXMode monitor database\nFully compatible with CGX V3\n68040 version of the CGX library")
)



;********************************************************************************
;German Strings
;********************************************************************************
(if (= @language "deutsch")
(
 (set #askzorro "\nWelche Erweiterungsslots besitzt der Computer, auf dem Sie CyberGraphX V3 installieren ?\n")
 (set #askcpu "\nWelchen Prozessor besitzt der Computer, auf dem Sie CyberGraphX V3 installieren wollen ? Der installer hat folgendes gefunden:\n")
 (set #wherelibs "Wohin sollen die CyberGraphX V3 Bibliotheken installiert werden? Standard ist 'SYS:Libs'")
 (set #whatboard (cat "\nBitte whlen Sie die Grafikkarte(n), mit denen Sie CyberGraphX V3 benutzen wollen:\n"))
 (set #todo-prompt "\nWelches der folgenden Programme wollen Sie installieren: ?\n")
 (set #cgxmode-todo " CGXMode - Erstellen & ndern von Bildschirmmodis")
 (set #wheremode "Wohin wollen Sie das CGXMode Programm kopiert haben?")
 (set #whereshowcgxconfig "Wohin wollen Sie das ShowCGXconfig Programm kopiert haben?")
 (set #showcgxconfig " ShowCGXconfig - CyberGraphX Informationsprogramm")

 ;***** New Strings for Aug-11-97
 (set #nocvppcboard "\n\n\nMomentan ist kein Treiber fr die CyberVisionPPC Grafikkarte frei verfgbar.")
 (set #noretinaboard "\n\n\nMomentan ist kein Treiber fr die Retina BLT Z3 Grafikkarte frei verfgbar.")
 (set #nopicasso4board "\n\n\nMomentan ist kein Treiber fr die PicassoIV Grafikkarte frei verfgbar.")
 (set #noinfernoboard "\n\n\nMomentan untersttzt dieses Skript die Installation der Inferno Grafikkarte noch nicht.")

 (set #ask-MODEFILE1 "Welche Monitorfrequenzdatei whlen Sie fr die ") 
 (set #ask-MODEFILE2 "? Die khz Angabe sollte die maximale khz Angabe fr ihren Bildschirm nicht berschreiten!")
 (set #15KHZ "15khz maximum") (set #31KHZ "31khz maximum")
 (set #35KHZ "35khz maximum") (set #38KHZ "38khz maximum")
 (set #48KHZ "48khz maximum") (set #57KHZ "57khz maximum")
 (set #64KHZ "64khz maximum") (set #80KHZ "80khz maximum")

 (set #yes "Ja")
 (set #no "Nein")
 (set #followingenv "\n\n\n\nDer folgende Abschnitt setzt die Umgebungsvariablen fr CyberGraphX V3.")
 (set #whatboard-tt "\n\n\n\nDie folgenden Piktogrammmerkmale werden gesetzt fr die:\n\n")



 ;*********** NEW Strings:  Wednesday 03-Sep-97 *************************
 (set #nobackup "\n\nDieses Installationsskript fhrt eine Erstinstallation von CyberGraphX V3 durch. Bevor Sie weitermachen, sollten Sie das evtl. vorhandene alte System mit dem entsprechend dafr vorgesehenen Programm sichern. Verwenden Sie dann das Programm zum Entfernen der alten RTG Systemsoftware. Wenn dieses Programm nicht vorhanden ist, so mssen Sie das manuell erledigen.\n\nSie mssen es auf jeden Fall tun, bevor sie mit dieser Installation fortfahren.")
 (set #whatboot "\nWelches StartupLogo wollen Sie installieren ?\n")
 (set #bootdefault "CyberGraphX - Standard")
 (set #bootppc "Light My Fire - PPC")
 (set #bootnone "Nichts kopieren - bereits installiert")


 ;*********** NEW English Strings:  Wednesday 22-Oct-97 *************************

 ;*********** NEW Strings:  Monday 01-Dec-97 *************************
 (set #noaga "\n\n\nEntweder untersttzt das Installationsskript nicht vollstndig den AGA Chipsatz oder der Treiber ist nicht verfgbar. Bitte schauen Sie unter http://www.vgr.com fr weitere Informationen.")
 (set #CGXModeNot4AGA " CGXMode - Nicht verwendbar fr den AGA Treiber!")
 (set #noenvaga "\n\nDie folgenden Variablen, die gesetzt werden, werden nur von _Grafikkarten_ verwendet. Sie werden NICHT vom AGA-PPC Treiber benutzt.")
 (set #multimediamem (cat "MULTIMEDIAMEM\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                          "Wenn MULTIMEDIAMEM=YES, reserviert CGX3 1MB Grafikspeicher der CV64/3D fr 3D Texturen & Video Overlays. "
                          "Wenn NO, verhlt sich die CV64/3D wie eine andere Karte, die diese Mglichkeiten nicht besitzt, wie z.B. die PicassoII."
                          "Sie erhalten dann volle 4MB Grafikspeicher fr Bildschirme mit ZorroIII Gerten (3.5MB bei ZorroII). "
                          "MULTIMEDIAMEM ist standardmig auf YES gesetzt (womit 3MB des Grafikspeichers fr Bildschirme genutzt werden)."
                     )
 )
 (set #blackborder   (cat "BLACKBORDER\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                          "Das Setzen des Merkmals 'BLACKBORDER=YES' fhrt dazu, da der Rahmen um "
                          "den Bildschirm schwarz dargestellt wird. Die RetinaBLT Z3 benutzt sonst immer Farbe 0, "
                          "wogegen andere Karten meist immer schwarz verwenden. Standardeinstellung ist 'BLACKBORDER=NO'."
                     )
 )
 (set #noboard "\nOne of the board(s) or chipset(s) you selected is not currently supported.\n\nPlease look on http://www.vgr.com for an update or wait until the next CyberGraphX archive is released.\n\nThe card with the missing driver was the:\n") 

 ;*********** NEW English Strings:  Wednesday 21-Jan-98 **********************
 (set #updatep4flash "\nUm CyberGraphX3 mit der PicassoIV zu benutzen, sollten sie auf jeden Fall die Version 2.0 oder grer des PicassoIV FlashROMs installieren.\n\nDas Installationsskript entdeckte eine ltere Version.\n\nFr weitere Informationen und eine neuere FlashROM Version kontaktieren Sie bitte:\nIhren Hndler\nVillageTronic\ndie VillageTronic WWW Seite\n")
)
)


;********************************************************************************
; French Strings by: Gregory Eycken <geycken@geocities.com>
;********************************************************************************
(if (= @language "franais")
(
 (set #askzorro "\nSur quel type d'ordinateur CyberGraphX V3 va-t-il tre install?\n")
 (set #askcpu "\nQuel est le processeur de l'ordinateur sur lequel vous voulez installer CyberGraphX V3? L'installeur a trouv :\n")
 (set #wherelibs "O dsirez-vous installer les bibliothques de CyberGraphX V3? Par dfaut, c'est 'SYS:Libs'.")
 (set #whatboard (cat "\nVeuillez slectionner la carte graphique dont vous voulez installer le fichier moniteur :\n"))
 (set #todo-prompt "\nDsirez-vous installer :\n")
 (set #cgxmode-todo " CGXMode - Crer et modifier les modes d'cran")
 (set #wheremode "O dsirez-vous installer le programme CGXMode?")
 (set #whereshowcgxconfig "O dsirez-vous installer le programme ShowCGXconfig?")
 (set #showcgxconfig " ShowCGXconfig - Programme d'informations CyberGraphX")

 ;***** New Strings for Aug-11-97
 (set #nocvppcboard "\n\n\nIl n'y a actuellement pas de fichier moniteur pour la carte graphique CyberVisionPPC.")
 (set #noretinaboard "\n\n\nIl n'y a actuellement pas de fichier moniteur pour la carte graphique Retina BLT Z3.")
 (set #nopicasso4board "\n\n\nIl n'y a actuellement pas de fichier moniteur pour la carte graphique Picasso IV.")
 (set #noinfernoboard "\n\n\nLe script d'installation n'a pas conu pour supporter entirement l'Inferno.") 

 (set #ask-MODEFILE1 "Quel fichier de modes dsirez-vous installer pour la ") 
 (set #ask-MODEFILE2 "?\nLe nombre de kHz ne devrait pas dpasser la limite maximale de votre moniteur!")
 (set #none "Aucun")
 (set #15KHZ "15kHz maximum") (set #31KHZ "31kHz maximum")
 (set #35KHZ "35kHz maximum") (set #38KHZ "38kHz maximum")
 (set #48KHZ "48kHz maximum") (set #57KHZ "57kHz maximum")
 (set #64KHZ "64kHz maximum") (set #80KHZ "80kHz maximum")

 (set #yes "Oui")
 (set #no "Non")
 (set #followingenv "\n\n\n\nLa partie suivante de l'installation va configurer les variables d'environnement pour CyberGraphX V3.")
 (set #whatboard-tt "\n\n\n\nLa partie suivante de l'installation va configurer les ToolTypes du fichier moniteur de la\n")



 ;*********** New Strings for Wednesday 03-Sep-97 *************************
 (set #nobackup "\n\nCe script d'installation va installer CyberGraphX V3 pour la premire fois.\n\nAvant de poursuivre, si vous utilisez un autre systme RTG, faites un archivage puis une dinstallation  l'aide des utilitaires fournis avec cet autre systme. Si ce systme ne contient pas d'utilitaires, enlevez les fichiers manuellement.\n\n")
 (set #whatboot "\nQuel logo dsirez-vous afficher durant l'initialisation?\n")
 (set #bootdefault "CyberGraphX - Par dfaut")
 (set #bootppc "Light My Fire - Pour les PowerPC")
 (set #bootnone "Ne rien copier - Le logo est dj install")

 ;*********** New Strings for Wednesday 22-Oct-97 *************************

)
)

;********************************************************************************
; Start Update
;********************************************************************************
;(message #by)
(message #nobackup)


;*******************************************************************
;  What board to update
;*******************************************************************
(set BGuess 0)

(if (> (exists ("devs:monitors/MediatorViRGE")) 0) (set BGuess (+ BGuess 1)) )


  (set board (askoptions (choices  " MediatorViRGE" 
                          (prompt #whatboard)
	                  (help #whatboard)
                          (default BGuess)
                         )
             )     
  )

(if (AND (= (exists (tackon "S3Drivers" "MediatorViRGE")) 0) (IN board 0) ) (abort (cat #noboard "MediatorViRGE")) )


;********************************************************************
; Double Check on the CPU
;********************************************************************
(procedure askaboutcpu

(set cpu (database "cpu"))
(if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 0))
(if (= cpu 68020) (set #cpu 0)) (if (= cpu 68030) (set #cpu 0))
(if (= cpu 68040) (set #cpu 1)) (if (= cpu 68060) (set #cpu 1)) 
(if (= @installer-version 0)
  (if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 1) )
  (if (= cpu 68060) (set #cpu 1))
)
(if (> (exists ("libs:PPC.library")) 0) (set #cpu 2) )

(set cpuPick (askchoice (choices "68020 or 68030" "68040 or 68060")
			(prompt #askcpu)
	                (help   #askcpu)
          		(default #cpu)
	  )
)

(if (= cpuPick 0) ((set cpuadd ".020") (set cpuadd-1 ".020")) )
(if (= cpuPick 1) ((set cpuadd ".040") (set cpuadd-1 ".040")) )

); END askaboutcpu

;(askaboutcpu)
(set cpuadd ".020") (set cpuadd-1 ".020")
 
;*******************************************************************
;  ASK where cybergfx libs are
;*******************************************************************
(set wherelibs   (askdir (prompt #wherelibs)
			 (help   #wherelibs)
 		         (default "SYS:Libs")
		 )
)

;*******************************************************************
;  Copy libs if there
;*******************************************************************
(if (exists (tackon "cgxsystemlib" (cat "cgxsystem.library" cpuadd-1)) )
  (copyfiles (source (tackon "cgxsystemlib" (cat "cgxsystem.library" cpuadd-1))) (dest wherelibs) (newname "cgxsystem.library") (optional "nofail") ) 
)


;(if (exists (tackon "cgxbootpiclib" (cat "cgxbootpic.library" cpuadd)) )
;  (copyfiles (source (tackon "cgxbootpiclib" (cat "cgxbootpic.library" cpuadd))) (dest wherelibs) (newname "cgxbootpic.library") (optional "nofail") ) 
;)

;*******************************************************************
;  Ask What bootlogo....
;*******************************************************************
(if (> (exists ("c:multiview")) 0)  ((set #mpath "c:") (set mfound 1)) )
(if (> (exists ("sys:Utilities/multiview")) 0) ((set #mpath "sys:Utilities") (set mfound 1)) )
(if (= mfound 1) (run (cat "run " (tackon #mpath "multiview ") "cgxbootpiclib/bootlogos.iff")) )

(if (exists "libs:cgxbootpic.library") (set whatboot 1))
(set whatboot  (askchoice
               (choices #bootdefault #bootnone)
               (prompt #whatboot)
               (help   #whatboot)
               (default whatboot)
              )
)

(if (AND (exists "cgxbootpiclib/cgxbootpic.library") (= whatboot 0))
  (copyfiles (source "cgxbootpiclib/cgxbootpic.library") (dest wherelibs) (optional "nofail") ) 
)


;*******************************************************************
;  Install monitor file and handle extra libs 
;*******************************************************************
  (if (IN board 0)
   (
     (set zadd "")  

     (if (exists (tackon "S3Drivers" (cat "MediatorViRGE" zadd)))
      (if (= (exists (tackon "devs:monitors" "MediatorViRGE.info")) 0)      
       (copyfiles (source (tackon "S3Drivers" (cat "MediatorViRGE" zadd))) (dest "devs:monitors") (infos) (optional "nofail") ) 
       (copyfiles (source (tackon "S3Drivers" (cat "MediatorViRGE" zadd))) (dest "devs:monitors") (optional "nofail") ) 
      )      
     )

     (if (exists (tackon "cgxvideolib" (cat "cgxvideo.library" cpuadd)) )
       (copyfiles (source (tackon "cgxvideolib" (cat "cgxvideo.library" cpuadd))) (dest wherelibs) (newname "cgxvideo.library") (optional "nofail") ) 
     )

     (if (exists (tackon "cgx3dvirgelib" (cat "cgx3dvirgin.library" "")) )
       (copyfiles (source (tackon "cgx3dvirgelib" (cat "cgx3dvirgin.library" ""))) (dest wherelibs) (newname "cgx3dvirgin.library") (optional "nofail") ) 
     )

   )
  )


;*********************************************************************************
; Setup Monitor Config File Setup
;*********************************************************************************
(set modefile 0)
(procedure askconfigfile
  (set modefile (askchoice
                 (choices "None/Skip" #31KHZ #35KHZ #38KHZ #48KHZ #57KHZ #64KHZ #80KHZ)
                 (prompt (cat #ask-MODEFILE1 boardname #ask-MODEFILE2))
                 (help   (cat #ask-MODEFILE1 boardname #ask-MODEFILE2))
                 (default modefile)
                )
  )

  (if (> modefile 0)
   (
    (if (< (exists "env:CyberGraphX") 2) (makedir "env:CyberGraphX") )    
    (if (< (exists "envarc:CyberGraphX") 2) (makedir "envarc:CyberGraphX") )    

    (if (= modefile 1) (set mode "Monitor-31khz")) (if (= modefile 2) (set mode "Monitor-35khz")) 
    (if (= modefile 3) (set mode "Monitor-38khz")) (if (= modefile 4) (set mode "Monitor-48khz")) 
    (if (= modefile 5) (set mode "Monitor-57khz")) (if (= modefile 6) (set mode "Monitor-64khz")) 
    (if (= modefile 7) (set mode "Monitor-80khz")) 

    (if (< (exists "sys:prefs") 2) (makedir "sys:prefs") )  
    (if (< (exists "sys:prefs/presets") 2) (makedir "sys:prefs/presets") )  
    (if (< (exists "sys:prefs/presets/monitors") 2) (makedir "sys:prefs/presets/monitors") )    
    (copyfiles (source (cat "prefs/presets/monitors/" mode))  (dest "sys:prefs/presets/monitors")) 

    ;(message (cat "setenv CyberGraphX/" boardname "Monitor " mode))
    ;(run (cat "setenv CyberGraphX/" boardname "Monitor " mode))

    (delete (cat "env:CyberGraphX/" boardname "Monitor"))
    (textfile (dest (cat "env:CyberGraphX/" boardname "Monitor")) (append mode))
    (copyfiles (source (cat "env:CyberGraphX/" boardname "Monitor"))  (dest "envarc:CyberGraphX") )
   )
  )
)

(if (IN board 0) ( (set boardname "MediatorViRGE") (askconfigfile))) 



;*********************************************************************************
;* TTs & ENVs 
;*********************************************************************************
(message #envtt)

;*********************************************************************************
;* Ask user to install CGXMode 
;*********************************************************************************
(set toolpick 3)

  (set ToDo (askoptions (choices #cgxmode-todo #showcgxconfig)
                        (prompt #todo-prompt)
                        (help #todo-prompt)
                        (default toolpick)
            )
  ) 

  (if (IN ToDo 0) 
    ( 
      (set wheremode   (askdir (prompt #wheremode)
                               (help   #wheremode)
	                       (default "SYS:Prefs")
		       )
      )

      (if (exists "CGXMode/CGXMode")
       (if (= (exists (tackon wheremode "CGXMode.info")) 0)
        (copyfiles (source "CGXMode/CGXMode")  (dest wheremode) (infos) (optional "nofail")) 
        (copyfiles (source "CGXMode/CGXMode")  (dest wheremode) (optional "nofail"))          
       )
      )

      ;(if (IN board 0) (set TTBOARD "MediatorViRGE") ) 

      ;(if (> board 0)
      ;  (tooltype (dest (tackon wheremode "CGXMode")) (settooltype "BOARD" TTBOARD) ) 
      ;)

      (if (= @language "deutsch")
       (
         (if (= (exists "Locale:Catalogs") 0) (makedir "sys:Locale/Catalogs") )
         (if (= (exists (tackon "Locale:Catalogs" "deutsch")) 0) (makedir (tackon "sys:Locale/Catalogs" "deutsch")) )
         (if (exists "CGXMode/catalogs/deutsch/cgxmode.catalog")
           (copyfiles (source "CGXMode/catalogs/deutsch/cgxmode.catalog") (dest "sys:Locale/Catalogs/deutsch") )
         )
       )
      )

    )
  )


(if (IN ToDo 1) 
  ( 
    (set whereshowcgxconfig   (askdir (prompt #whereshowcgxconfig)
                             (help   #whereshowcgxconfig)
	                     (default "SYS:Tools")
		     )
    )

    (if (exists "tools/showcgxconfig")
     (if (= (exists (tackon whereshowcgxconfig "CGXMode.info")) 0)
      (copyfiles (source "tools/showcgxconfig")  (dest whereshowcgxconfig) (infos) (optional "nofail")) 
      (copyfiles (source "tools/showcgxconfig")  (dest whereshowcgxconfig) (optional "nofail"))          
     )
    )

  )
)
 




;*******************************************************************
;  END
;*******************************************************************
(message #cgxv4)


(if (> (exists ("c:multiview")) 0) (set #mpath "c:") )
(if (> (exists ("sys:Utilities/multiview")) 0) (set #mpath "sys:Utilities") )

(run (cat "run " #mpath "/multiview ReadMe.txt") )

(set @default-dest "ram:")

(exit)
